import request from '@/config/axios'

// 多边形顶点坐标 VO
export interface MapPolygonPointVO {
  id: number // 顶点ID
  polygonId: string // 关联多边形ID（关联member_map_polygon.id）
  ringIndex: number // 环索引（0-外环，1+内环，用于复杂多边形）
  lng: number // 经度（范围：-180~180）
  lat: number // 纬度（范围：-90~90）
  pointIndex: number // 顶点顺序（同一环内从0开始）
  createdAt: Date // 创建时间
}

// 多边形顶点坐标 API
export const MapPolygonPointApi = {
  // 查询多边形顶点坐标分页
  getMapPolygonPointPage: async (params: any) => {
    return await request.get({ url: `/member/map-polygon-point/page`, params })
  },

  // 查询多边形顶点坐标详情
  getMapPolygonPoint: async (id: number) => {
    return await request.get({ url: `/member/map-polygon-point/get?id=` + id })
  },

  // 新增多边形顶点坐标
  createMapPolygonPoint: async (data: MapPolygonPointVO) => {
    return await request.post({ url: `/member/map-polygon-point/create`, data })
  },

  // 修改多边形顶点坐标
  updateMapPolygonPoint: async (data: MapPolygonPointVO) => {
    return await request.put({ url: `/member/map-polygon-point/update`, data })
  },

  // 删除多边形顶点坐标
  deleteMapPolygonPoint: async (id: number) => {
    return await request.delete({ url: `/member/map-polygon-point/delete?id=` + id })
  },

  // 导出多边形顶点坐标 Excel
  exportMapPolygonPoint: async (params) => {
    return await request.download({ url: `/member/map-polygon-point/export-excel`, params })
  }
}